﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using WorkStation.Frameworks.EasyBus.MessageQueue;

namespace WorkStation.Frameworks.EasyBus.MessageQueue.Msmq
{
    /// <summary>
    /// MSMQ 地址翻译器实现
    /// </summary>
    public class MsmqAddressTranslator : QueueAddressTranslatorBase
    {
        public static readonly string ADDRESS_NAME_KEY = "Address";

        #region 公有属性

        public override string Prefix { get { return "Msmq"; } }

        public override Type EndpointType { get; protected set; }

        #endregion

        public MsmqAddressTranslator() 
        {
            this.ParameterNames.Add(ADDRESS_NAME_KEY);

            this.EndpointType = typeof(MsmqEndpoint);
        }

        protected override IEndpoint TranslateToEndpointCore(Dictionary<string, string> parameters)
        {
            return new MsmqEndpoint(parameters[ADDRESS_NAME_KEY]);
        }
    }
}
